package methods

/*
演示返回多个值
*/

import "fmt"

func vals() (int, int) {
	return 3, 7
}

func getPersonInfo() (firstName, middleName, lastName string) {
	firstName = "Cai"
	lastName = "Collin"
	middleName = "H"

	//直接使用return
	return
}

func MultiValues() {
	a, b := vals()

	fmt.Println(a)
	fmt.Println(b)
	// _ 占位符，表示忽略返回的对于的值。
	_, c := vals()
	fmt.Println(c)

	firstName, middleName, lastName := getPersonInfo()
	fmt.Printf("firstName: %s, middleName: %s, lastName: %s\n", firstName, middleName, lastName)
}
